package cn.xz.kjg.adapter

import android.widget.TextView
import cn.xz.kjg.R
import cn.xz.kjg.bean.AreaList
import cn.xz.kjg.bean.HP
import cn.xz.kjg.util.AppHelper
import cn.xz.kjg.widgets.XZTextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.module.LoadMoreModule
import com.chad.library.adapter.base.viewholder.BaseViewHolder

/**
 * 分屏列表适配器*/
class SPAdapter: BaseQuickAdapter<HP, BaseViewHolder>(R.layout.item_sp_fp), LoadMoreModule {

    override fun convert(holder: BaseViewHolder, item: HP) {
        //只有第一条显示占位图
        if (holder.adapterPosition == 0) {
            holder.setVisible(R.id.view_zw, true)
        } else {
            holder.setGone(R.id.view_zw, true)
        }

        val tvLightTxt = holder.getView<TextView>(R.id.tv_txt)
        tvLightTxt.text = item.name.toString()
        if (item.name.toString().length > 4){
            tvLightTxt.textSize = 9f
        }else{
            tvLightTxt.textSize = 12f
        }

        var mD = AppHelper.getDrawable(R.mipmap.icon_tt)
        if (item.select){
            mD = AppHelper.getDrawable(R.mipmap.icon_tt_1)
        }
        tvLightTxt.background = mD
    }
}